home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-24 | 3.0 KB | 117 lines | [TEXT/XLOG] |
-
- prolog(jb_prolog).
-
- t(T) :- prolog(jb_prolog), system_get(tick_msec,T).
- t(T) :- prolog(aais_prolog), time(T1), T is integer(T1*1000/60).
- t(T) :- prolog(open_prolog), T is cputime.
- t(T) :- prolog(lpa_prolog), ticks(T1), T is int(T1*1000/60).
-
- /*****************************************************************/
- /*****************************************************************/
-
- line(zh, sg).
- line(ol, zh).
- line(zg, zh).
- line(lu, zg).
- line(ag, zg).
- line(lu, ag).
- line(lg, ag).
- line(ol, lu).
- line(be, lu).
- line(bs, ol).
- line(bl, ol).
- line(be, ol).
- line(ne, bl).
- line(ne, be).
- line(la, be).
- line(sp, be).
- line(br, sp).
- line(ma, br).
- line(la, ma).
- line(la, ne).
- line(ge, la).
-
- dire(X,Y) :- line(X,Y).
- dire(X,Y) :- !, line(Y,X).
-
- member(X,[X|_]).
- member(X,[_|Y]) :- !, member(X,Y).
-
- find(X,Y,L,R) :- dire(X,Z), \+member(Z,L), find(Z,Y,[Z|L],R).
- find(X,X,L,L).
-
- verb(X,Y,L) :- !, find(X,Y,[X],L).
-
- path :- verb(zh,ne,_), fail; true.
-
- /*****************************************************************/
- /*****************************************************************/
-
- pair(red,green).
- pair(red,blue).
- pair(red,black).
- pair(green,blue).
- pair(green,black).
- pair(blue,black).
-
- next(X,Y) :- pair(X,Y).
- next(Y,X) :- !, pair(X,Y).
-
- color(A,B,C,D,E) :-
- next(A,C), next(C,E), next(A,B),
- next(B,E), next(D,E), next(B,C),
- next(A,D), next(C,D).
- color(A,B,C,D,E) :-
- next(A,C), next(D,E), next(A,B),
- next(B,E), next(C,E), next(B,C),
- next(A,D), next(C,D).
-
- back :- color(_,_,_,_,_), fail; true.
-
- /*****************************************************************/
- /*****************************************************************/
-
- concatenate([X|L1],L,[X|L2]) :- !, concatenate(L1,L,L2).
- concatenate([],L,L).
-
- nreverse([X|L0],L) :- nreverse(L0,L1), concatenate(L1,[X],L).
- nreverse([],[]).
-
- list([a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,
- a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,
- a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a]).
- list([a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,
- a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,
- a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a]).
- list([a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,
- a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,
- a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a]).
-
- nrev :- list(X), nreverse(X,_), fail; true.
-
- /*****************************************************************/
- /*****************************************************************/
-
- range(X,L,H) :- L=<H, M is (L+H)/2, !, range1(X,L,H,M).
-
- range1(X,L,_,M) :- H1 is M-1, range(X,L,H1).
- range1(X,_,_,X).
- range1(X,_,H,M) :- L1 is M+1, !, range(X,L1,H).
-
- arith :- range(X,1,350), _ is 99999/(X*11), fail; true.
-
- /*****************************************************************/
- /*****************************************************************/
-
- mesure(X) :-
- t(T1), X, t(T2),
- T is T2-T1,
- write(T), nl.
-
- bench :-
- mesure(path),
- mesure(back),
- mesure(nrev),
- mesure(arith),
- nl.
-